package com.atguigu.gmall.all.controller;


import com.atguigu.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping
public class ItemController {


    @Autowired
    private ItemFeignClient itemFeignClient;
    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable(name = "skuId") Long skuId, Model model){
        model.addAllAttributes(itemFeignClient.getItem(skuId));
        return "item/index";
    }
}
